/*
 * 2005-11-17 lxm 创建。 
 */
package com.hd123.rumba.domain;

import java.util.List;

import org.apache.axis.AxisFault;

import com.hd123.rumba.request.SessionedService;
import com.hd123.rumba.runtime.NamingMgr;

/**
 * @author lxm
 * 
 * 关于域的Web Service对象
 */
public class DDomainMgr extends SessionedService {

  public DDomain getDomain(String uuid) throws AxisFault {
    try {
      IDomainMgr domainMgr = (IDomainMgr) NamingMgr.getInstance().lookupMgr(IDomainMgr.class);
      IDomain n = domainMgr.getDomain(uuid);
      return DDomain.create(n);
    } catch (Exception e) {
      throw AxisFault.makeFault(e);
    }
  }
  
  public DDomain getDomainByCode(String code) throws AxisFault {
    try {
      IDomainMgr domainMgr = (IDomainMgr) NamingMgr.getInstance().lookupMgr(IDomainMgr.class);
      IDomain n = domainMgr.getDomainByCode(code);
      return DDomain.create(n);
    } catch (Exception e) {
      throw AxisFault.makeFault(e);
    }
  }
  
  public DDomain getRootDomain () throws AxisFault {
    try {
      IDomainMgr domainMgr = (IDomainMgr) NamingMgr.getInstance().lookupMgr(IDomainMgr.class);
      IDomain n = domainMgr.getRootDomain();
      return DDomain.create(n);
    } catch (Exception e) {
      throw AxisFault.makeFault(e);
    }
  }
  
  public DDomainPage createChildDomainsList(String domainUuid) throws AxisFault {
    try {
      IDomainMgr domainMgr = (IDomainMgr) NamingMgr.getInstance().lookupMgr(IDomainMgr.class);
      IDomain parent = domainMgr.getDomain(domainUuid);
      List list = domainMgr.createChildDomainsList(parent);
      return DDomainPage.create(list);
    } catch (Exception e) {
      throw AxisFault.makeFault(e);
    }
  }
  
}
